import { createRouter, createWebHistory } from 'vue-router'
// import Layout from '@/layout/index.vue'
import Layout from '../layout/index.vue'



// 公共路由
export const constantRoutes = [
  {
    path: '',
    component:Layout,
    redirect: '/home',
    children:[
      {
        path: '/home',
        component: () => import('../views/home/index.vue'),
        name: 'home',
      }
    ]
  },
  {
    path:'/detail',
    component: Layout,
    redirect: '/detail',
    children: [
      {
        path: '/detail',
        component:()=>import('../views/detail'),
        name:'detail'
      }
    ]
  },
  {
    path: '/login',
    component: ()=> import('../views/login')
  },
  {
    path: '/signUp',
    component: ()=> import('../views/singUp')
  },
  {
    path: '/forgot',
    component: ()=>import('../views/forgot')
  },
  {
    path: '/404',
    component: () => import('../views/404')
  }

]


const router = createRouter({
  history: createWebHistory(),
  routes: constantRoutes,
})

export default router
